package com.tanhua.model.vo;

import cn.hutool.core.util.ObjectUtil;
import com.tanhua.model.domain.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @author Xiao
 * @date 2021/10/22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoVO implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String birthday; //生日
    private String gender; //性别
    private String age; //年龄    Integer --> String
    private String city; //城市
    private String income; //收入
    private String education; //学历
    private String profession; //行业
    private Integer marriage; //婚姻状态

    public static UserInfoVO init(UserInfo userInfo) {
        UserInfoVO userInfoVO = new UserInfoVO();
        if (ObjectUtil.isNotEmpty(userInfo)) {
            BeanUtils.copyProperties(userInfo, userInfoVO);
            userInfoVO.setAge(userInfo.getAge().toString());
        }
        return userInfoVO;
    }
}
